package com.chj.service;

import com.chj.dao.repository.DictionaryRepository;
import com.chj.dao.repository.UserRepository;
import com.chj.entity.DictionaryEntity;
import com.chj.entity.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service
public class UserService {

    @Autowired
    private UserRepository userRepository;

    @Transactional
    public long addOne(UserEntity entity) {
        entity = this.userRepository.save(entity);
        return entity.getId();
    }

    public List<UserEntity> getList() {
        return this.userRepository.findAll();
    }

}
